<?php
//echo 'tes aja'; exit;

    foreach ($getDetail as $a) {
        $aId   			= $a["SIK_ID"];
    	$aNik   		= $a["SIK_NIK"];
    	$aSdate   		= $a["SIK_SDATE"];
    	$aEdate   		= $a["SIK_EDATE"];
    	$aShours   		= $a["SHOURS"];
    	$aEhours   		= $a["EHOURS"];
    	$aShoure   		= $a["SHOURE"];
    	$aEhoure   		= $a["EHOURE"];
    	$aVendorId   	= $a["VENDOR_ID"];
    	$aVendorName   	= $a["VENDOR_NAME"];
    	$aVendorJabatan = $a["VENDOR_JABATAN"];
    	$aVendorPic   	= $a["VENDOR_PIC"];
    	$aUntukNik   	= $a["SIK_UNTUK_NIK"];
    
    	$aSikAtasanNik  = $a["SIK_ATASAN_NIK"];
    	$aSikAtasanName = $a['ATASANNAME'];
    	$cName			= $a['NIKNAME'];
    	$cJob			= $a['NIKJOBPOSITION'];
    	$cOrg			= $a['NIKORG'];
    }
    //belum bisa dikerjakan, menunggu session user login
    //if (empty($org)) $org = dbora_getorg($nik);
    //if(empty($org)){
    //	$org = dbora_getorg("$nik");
    //}
    
    
?>

<script>
    function cancel() {
        $.post("<?= site_url() ?>search_global", function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        });
    }
    function closeSrnKrjSikSave() {
        $radioChecked='';
        if (document.getElementById("pApprovalY").checked == true){
            $radioChecked = "Y"; 
        }
        else{
            $radioChecked = "N";
        }
        
        $.post("<?= site_url() ?>search_global/closing_reqSave", {
            pCtrlID: $('#pCtrlID').val(),
            pCType: $('#pCType').val(),
            pApproval: $radioChecked 
            //pComment: $('#pComment').val(),
            //pAccesNo: $('#pAccesNo').val()
        },
        function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        }
        );
    }
</script>


<form id="formarea" role="form" method="post" action="#">
<input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
<input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
<div class="col-md-offset-0" id="top">
    <div class="col-md-11">
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Requestor </b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">NIK</label>
    						<div class="col-md-9"><?php echo $aUntukNik;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama</label>
    						<div class="col-md-9"><?php echo $cName;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Departemen</label>
    						<div class="col-md-9"><?php echo $cOrg;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Position</label>
    						<div class="col-md-9"><?php echo $cJob;?></div>
				        </div>
                    </div>                   
                </div>
                
            </div>
        </div>
        
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Request </b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Vendor</label>
    						<div class="col-md-9"><?php echo $aVendorName;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">PIC</label>
    						<div class="col-md-9"><?php echo $aVendorPic;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Jabatan</label>
    						<div class="col-md-9"><?php echo $aVendorJabatan;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Tgl &amp; Jam Pekerjaan</label>
    						<div class="col-md-9"><?php echo "$aSdate $aShours:$aEhours s/d<br />$aEdate $aShoure:$aEhoure";?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama Atasan</label>
    						<div class="col-md-9"><?php echo $aSikAtasanName;?></div>
				        </div>
                    </div>                   
                </div>
                
                <div class="table-responsive">
                                <table class="table table-bordered table-condensed table-striped" style="background:#f9f9f9;">
                                    <thead>
                                        <tr>
                                            <th class="tblhead" style="width:5%;text-align:center;">No</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Nama</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Pekerjaan</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Lantai</th>
                                            <th class="tblhead" style="width:40%;text-align:center;">Location</th>
                                            <th class="tblhead" style="width:5%;text-align:center;">Access</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Nama Barang</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">S/N</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        $i=0;
                                        foreach ($getDetail2 as $b) {
                                                    $bId   		= $b["SIKJ_ID"];
													$bName  	= $b["SIKJ_NAME"];
													$bPekerjaan = $b["SIKJ_DESC"];
													$bLantai    = $b["SIKJ_FLOOR"];
													$bLocation  = $b["SIKJ_LOCATION"];
													$bAccess    = $b["SIKJ_ACCESS"];
													$bBarang    = $b["SIKJ_BARANG"];
													$bSn  		= $b["SIKJ_SN"];
                                            ?>
                                        <tr>
                                            <td style="font-size:10px;"><?php echo ++$i; ?></td>
                                            <td style="font-size:10px;"><?php echo $bName; ?></td>
                                            <td style="font-size:10px;"><?php echo $bPekerjaan; ?></td>
                                            <td style="font-size:10px;"><?php echo $bLantai; ?></td>
                                            <td style="font-size:10px;"><?php echo $bLocation; ?></td>
                                            <td style="font-size:10px;"><?php echo $bAccess; ?></td>
                                            <td style="font-size:10px;"><?php echo $bBarang; ?></td>
                                            <td style="font-size:10px;"><?php echo $bSn; ?></td>
                                        </tr>
                                        <?php
                                        }
                                        ?>
                                    </tbody>
                                </table>
                </div>
                            
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Closing Order</label>
    						<div class="col-md-9">
                            <input type="radio" name="radioApp" id="pApprovalY" value="Y"/>Yes
                            <input type="radio" name="radioApp" id="pApprovalN" value="N" checked=""/>No
                            </div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
    						<div class="col-sm-2">
                                <button type="button" class="btn btn-primary btn-block" onclick="closeSrnKrjSikSave();">Submit</button>
                            </div>
                            <div class="col-sm-2">
                                <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                            </div>
				        </div>
                    </div>                   
                </div>
            </div>
        </div>
    
    </div>
</div>
</form>